﻿using Godot;

namespace VectorSurvivors.GameWorld;

[GlobalClass]
public abstract partial class Entity : Node2D
{
    public long Id { get; private set; } = -1;
    public World CurrentWorld { get; private set; }
    public string EntityType { get; internal set; }
    
    protected Entity(){}

    public void ChangeWorld(World world)
    {
        CurrentWorld?.RemoveChild(this);
        
        CurrentWorld = world;
        CurrentWorld.AddChild(world);
    }

    public EntityInfo GetInfo()
    {
        return new EntityInfo(Id, EntityType, Position, Rotation);
    }
}